package com.maxmind.common;



import java.io.Serializable;

public class Response<T>
        implements Serializable
{
    private static final long serialVersionUID = -4505655308965878999L;
    private static final String successCode = "0";

    private T data;

    private String code;

    private Object msg;

    private Response()
    {
        this.code = "0";
        this.msg = "success";
    }

    private Response success(T data) {
        this.data = data;
        return this;
    }

    private Response fail(String code, Object msg) {
        this.code = code;
        this.msg = msg;
        return this;
    }

    public static Response builderSuccess(Object o) {
        return new Response().success(o);
    }

    public static Response builderFail(String code, Object msg) {
        return new Response().fail(code, msg);
    }

    public T getData()
    {
        return this.data;
    }
    public String getCode() {
        return this.code;
    }
    public Object getMsg() {
        return this.msg;
    }

    public void setData(T data)
    {
        this.data = data; }
    public void setCode(String code) { this.code = code; }
    public void setMsg(Object msg) { this.msg = msg; }
    public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof Response)) return false; Response other = (Response)o; if (!other.canEqual(this)) return false; Object this$data = getData(); Object other$data = other.getData(); if (this$data == null ? other$data != null : !this$data.equals(other$data)) return false; Object this$code = getCode(); Object other$code = other.getCode(); if (this$code == null ? other$code != null : !this$code.equals(other$code)) return false; Object this$msg = getMsg(); Object other$msg = other.getMsg(); return this$msg == null ? other$msg == null : this$msg.equals(other$msg); }
    protected boolean canEqual(Object other) { return other instanceof Response; }
    public int hashCode() { int PRIME = 59; int result = 1; Object $data = getData(); result = result * 59 + ($data == null ? 43 : $data.hashCode()); Object $code = getCode(); result = result * 59 + ($code == null ? 43 : $code.hashCode()); Object $msg = getMsg(); return result * 59 + ($msg == null ? 43 : $msg.hashCode()); }
    public String toString() { return "Response(data=" + getData() + ", code=" + getCode() + ", msg=" + getMsg() + ")";
    }
}
